<template>
    <view class="page-content">
        <view class="m-t-10 p-l-18 p-r-18 m-auto view justify-center align-center c_3c3 fz-14">
            <view class="width100 bgs rel">
                <textarea  v-model="keyword" class="width100 h156 c_3c3 fz-14 bor-rad12 bg_fff" style="border: 1px solid rgba(116, 143, 172, 0.41);" placeholder="扫一扫或输入助记词 (用空格分离)、私钥、Keystore文件内容"/>
                <view class="w55 fz-13 c_4d4 bor-rad12 abs bg_f7f h22 view flex-row align-center justify-center" style="border: 1px solid #D6D6D7;right: 18px;bottom: 14px;">粘贴</view>
            </view>
            <view class="width100 view flex-row align-center h54  bgs m-t-10">
                <view class="w78 p-l-6" style="box-sizing: border-box;">设置密码</view>
                <input v-model="newpassword" class="flex-1 h53 c_3c3 fz-14" style="border-bottom: 1px solid #D1D4E8;"  type="password" placeholder="设置密码"/>
            </view>
            <view class="width100 view flex-row align-center h54  bgs ">
                <view class="w78 p-l-6" style="box-sizing: border-box;">重复密码</view>
                <input v-model="repassword" class="flex-1 h53 c_3c3 fz-14" style="border-bottom: 1px solid #D1D4E8;"  type="password" placeholder="重复密码"/>
            </view>
           
            <view class="fixed" style="bottom: 78px;left: 18px;right: 18px;">
              <button @click="replacePwd" class="bg_678 h47 bor-rad12 view align-center justify-center c_fff fz-16" :loading="btnLoading">确认重置</button>
            </view>
            
        </view>
        
    </view>
</template>

<script>

export default {
    components: {
      
    },
    data() {
        return {
          repassword: '',
          newpassword: '',
          keyword: '',
          btnLoading: false
        }
    },
    methods: {
      replacePwd() {
        if (!this.keyword) {
          this.app.tips('请输入助记词、私钥、Keystore文件内容！')
          return false
        }
        if (!this.newpassword) {
          this.app.tips('请输入密码')
          return false
        }
        if (!this.repassword) {
          this.app.tips('请重复密码')
          return false
        }
        if (this.newpassword != this.repassword) {
          this.app.tips('设置密码和重复密码不一致！')
          return false
        }
        this.btnLoading = true
        this.app.post({
          url: 'index.php/api/user/resetpwd',
          isBeforeLoginApi: true,
          data: {
            oldpassword: this.oldpassword,
            newpassword: this.newpassword
          }
        }, (res) => {
          this.btnLoading = false
          this.app.tips(res.msg)
          if (res.code == 1) {
            this.app.goBack()
          }
          
        })
      }
    }
};
</script>

<style lang="scss" scoped>

page {
    background-color:#F6F6F6;
    box-sizing: border-box;
    overflow-y: hidden;
		
  }
.bgs {
   background-position: center;
   background-size: cover;
   background-repeat: no-repeat;
       background-color: transparent;
 }
 .page-content {
    ::v-deep {
      .uni-textarea-placeholder,
      .uni-textarea-textarea {
          box-sizing: border-box;
          padding: 12px 18px;
        }
    }
 }
</style>
